<?php
$this->breadcrumbs = array(
	'Roles and Permissions' => array('roles/index'),
	$role->description
);
?>
<div class="main-title">
    <h1 class="float-left"><?php echo $role->description; ?></h1>
	<div class="controls">
		<a href="<?php echo $this->createUrl("roles/update", array("role_id"=> $role->name)); ?>" class="link-button">
			<img src="/images/icons/fugue/pencil.png" />
			Edit
		</a>
	</div>
</div>
<div class="flat_area">
	<div class="grid_16">
		<h2>Permissions</h2>
		<div id="permissions-table"  class="grid_16">
			<?php if (!empty($authItemGroups)): ?>
				<?php foreach ($authItemGroups as $groupName => $authItems): ?>
					<fieldset>
						<legend>
							<?php echo $groupName; ?>
						</legend>
						<?php if (!empty($authItems)): ?>
							<?php foreach ($authItems as $authItem): ?>
								<label for="<?php echo CHtml::getIdByName('operation[' . $authItem['name'] . ']'); ?>">
									<?php echo CHtml::checkBox('operation[' . $authItem['name'] . ']', $authManager->hasItemChild($role->name, $authItem['name']), array('uncheckValue' => 0, 'disabled' => $authItem['agency_id'] === null)); ?>
									<?php echo $authItem['description']; ?>
								</label>
							<?php endforeach; ?>
						<?php endif; ?>
					</fieldset>
				<?php endforeach; ?>
			<?php endif; ?>
		</div>
	</div>
</div>